// Auteur : Simon-Pierre Boucher — contact@spboucher.ai // Page d'identification d'un membre (cible du code QR de la carte) : // grande photo, identité complète, badge de vérification. Le courriel et // les coordonnées ne sont jamais exposés. import type { Metadata } from "next"; import { db } from "@/lib/db"; import { roleLabel } from "@/lib/roles"; export const metadata: Metadata = { title: "Identification de membre | Groupe KA", description: "Identification d'un membre du Groupe KA par son KA-ID.", robots: { index: false }, }; export const dynamic = "force-dynamic"; function fmtDate(iso: string | null): string { if (!iso) return "—"; const d = new Date(iso.includes("T") ? iso : iso.replace(" ", "T") + "Z"); if (Number.isNaN(d.getTime())) return "—"; return d .toLocaleDateString("fr-CA", { day: "numeric", month: "long", year: "numeric" }) .replace(/^1 /, "1ᵉʳ "); } export default async function IdentificationMembre({ params, }: { params: Promise<{ kaId: string }>; }) { const { kaId } = await params; const clean = /^ka-\d{10}$/.test(kaId) ? kaId : null; const row = clean ? (db .prepare( "SELECT ka_id, name, avatar_url, google_sub, role, created_at, last_login FROM users WHERE ka_id = ?", ) .get(clean) as | { ka_id: string; name: string; avatar_url: string | null; google_sub: string | null; role: string | null; created_at: string; last_login: string | null; } | undefined) : undefined; if (!row) { return (

Identification de membre

Identifiant introuvable

Aucun membre ne porte cet identifiant. Vérifiez le code, ou{" "} créez votre KA ID .

); } const infos: [string, string][] = [ ["Identifiant membre", row.ka_id], ...(roleLabel(row.role) ? ([["Statut", roleLabel(row.role)!]] as [string, string][]) : []), ["Membre depuis", fmtDate(row.created_at)], ["Dernière connexion", fmtDate(row.last_login)], ["Compte", row.google_sub ? "Lié à Google" : "Courriel vérifié"], ["Valide sur", "Les 7 plateformes ·Ka"], ]; return (

Identification de membre

{/* ——— La grande photo ——— */}
{row.avatar_url ? ( // eslint-disable-next-line @next/next/no-img-element {`Photo ) : ( {row.name.charAt(0).toUpperCase()} )}

{row.name}

Membre vérifié du Groupe KA

{/* ——— KA-ID ——— */}

KA-ID

{row.ka_id}

{/* ——— Toutes les infos ——— */}
{infos.map(([label, value], i) => (
{label} {value}
))}

Cette page confirme l'identité d'un membre à partir du code QR de sa carte. Le courriel et les coordonnées ne sont jamais affichés.

groupe-ka.com ↗
); }